package cn.edu.neusoft.wuguangsheng.market.activity;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import cn.edu.neusoft.wuguangsheng.market.R;

/**
 * Created by little on 2018/4/11.
 */

public abstract class BaseActivity extends AppCompatActivity {
    protected int layout_file= R.layout.activity_main;
    abstract void initView();
    abstract void initEvent();
    abstract void initDate();
    void setLayout_file(int layout_file){
        setContentView(layout_file);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();
        initDate();
        initEvent();
    }


    public String getuser(){
        SharedPreferences sp;
        sp=getSharedPreferences("userInfo", Context.MODE_PRIVATE);
        return sp.getString("username","");
    }

    public String getpass(){
        SharedPreferences sp;
        sp=getSharedPreferences("userInfo",Context.MODE_PRIVATE);
        return sp.getString("userpass","");
    }
    public String getid(){
        SharedPreferences sp;
        sp=getSharedPreferences("userInfo",Context.MODE_PRIVATE);
        return sp.getString("userid","");
    }

    public Boolean getUer_remember(){
        SharedPreferences sp;
        sp=getSharedPreferences(
                "userInfo",MODE_PRIVATE);
        return sp.getBoolean("remember",false);
    }

    public void showToast(String content){
        Toast.makeText(this,content,Toast.LENGTH_SHORT)
                .show();
    }

    public String getmrid(){
        SharedPreferences sp;
        sp=getSharedPreferences("userInfo",Context.MODE_PRIVATE);
        return sp.getString("mrid","");
    }


}
